//
// SoapTrace.Net - A soap message monitoring utility. 
//
// Copyright (C) 2005 Matthew Ward
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
//
// Matthew Ward (mrward@users.sourceforge.net)

using System;
using System.Drawing;
using System.Windows.Forms;
using System.Xml.Serialization;

namespace SoapTrace.Core
{
	/// <summary>
	/// Holds the configuration for the MainForm.
	/// </summary>
	[ XmlType( "mainform.config" ) ]
	public class MainFormConfiguration
	{
		/// <summary>
		/// The default location of the main form.
		/// </summary>
		Point m_Location = new Point( 0, 0 );
		
		/// <summary>
		/// The default size of the main form.
		/// </summary>
		Size m_ClientSize = new Size( 592, 289 );
		
		/// <summary>
		/// The text word wrap setting.
		/// </summary>
		bool m_WordWrap = true;
		
		/// <summary>
		/// The default window state.
		/// </summary>
		FormWindowState m_WindowState = FormWindowState.Normal;
		
		/// <summary>
		/// The default font to use to display text.
		/// </summary>
		string m_TextFontName = "Tahoma";
		float m_TextFontSize = 8.25F;
		FontStyle m_TextFontStyle = FontStyle.Regular;
		
		/// <summary>
		/// The default font to use to display the list view text.
		/// </summary>
		string m_ListFontName = "Tahoma";
		float m_ListFontSize = 8.25F;
		FontStyle m_ListFontStyle = FontStyle.Regular;
		
		bool m_ViewHttpHeaders;
		bool m_ViewRawSoapMessage;
		bool m_ViewSoapMessageParameters;
		bool m_ViewSoapEnvelope = true;
		
		int m_SoapMessagesPanelWidth = 200;
		
		int m_MessageRequestPanelHeight = 135;
		
		/// <summary>
		/// Default list view column widths.
		/// </summary>
		int m_TimeColumnHeaderWidth = 108;
		int m_WebServiceOperationColumnHeaderWidth = 100;
		int m_WebServiceColumnHeaderWidth = 200;
		int m_SourceColumnHeaderWidth = 100;
		
		bool m_ShowInTray = false;

		/// <summary>
		/// Creates a new instance of the <see cref="MainFormConfiguration"/>
		/// class.
		/// </summary>
		public MainFormConfiguration( )
		{
		}
		
		/// <summary>
		/// The location of the main form.
		/// </summary>
		[ XmlElement( "location" ) ]
		public Point Location
		{
			get
			{
				return m_Location;
			}
			
			set
			{
				m_Location = value;
			}
		}
		
		/// <summary>
		/// Gets or sets the main form's client area size.
		/// </summary>
		[ XmlElement( "clientSize" ) ]
		public Size ClientSize
		{
			get
			{
				return m_ClientSize;
			}
			
			set
			{
				m_ClientSize = value;
			}
		}
		
		/// <summary>
		/// Gets or sets the window state.
		/// </summary>
		[ XmlElement( "windowState" ) ]
		public FormWindowState WindowState
		{
			get
			{
				return m_WindowState;
			}
			
			set
			{
				m_WindowState = value;
			}
		}
		
		/// <summary>
		/// Gets or sets the text word wrap property.
		/// </summary>
		[ XmlElement( "wordWrap" ) ]
		public bool WordWrap
		{
			get
			{
				return m_WordWrap;
			}
			
			set
			{
				m_WordWrap = value;
			}
		}
		
		/// <summary>
		/// Gets or sets whether the application will be displayed in the tray.
		/// </summary>
		[ XmlElement( "showInTray" ) ]
		public bool ShowInTray 
		{
			get
			{
				return m_ShowInTray;
			}
			
			set
			{
				m_ShowInTray = value;
			}
		}
		
		/// <summary>
		/// Gets or sets the font to be used to display the soap 
		/// message text.
		/// </summary>
		[ XmlElement( "textFontName" ) ]
		public string TextFontName
		{
			get
			{
				return m_TextFontName;
			}
			
			set
			{
				m_TextFontName = value;
			}
		}
		
		/// <summary>
		/// Gets or sets the text font's size.
		/// </summary>
		[ XmlElement( "textFontSize" ) ]
		public float TextFontSize
		{
			get
			{
				return m_TextFontSize;
			}
			
			set
			{
				m_TextFontSize = value;
			}
		}
		
		/// <summary>
		/// Gets or sets the text font's style.
		/// </summary>
		[ XmlElement( "textFontStyle" ) ]
		public FontStyle TextFontStyle
		{
			get
			{
				return m_TextFontStyle;
			}
			
			set
			{
				m_TextFontStyle = value;
			}
		}

		/// <summary>
		/// Gets or sets the font to use in the list view.
		/// </summary>
		[ XmlElement( "listFontName" ) ]
		public string ListFontName
		{
			get
			{
				return m_ListFontName;
			}

			set
			{
				m_ListFontName = value;
			}
		}
		
		/// <summary>
		/// Gets or sets the list font's size.
		/// </summary>
		[ XmlElement( "listFontSize" ) ]
		public float ListFontSize
		{
			get
			{
				return m_ListFontSize;
			}
			
			set
			{
				m_ListFontSize = value;
			}
		}	
		
		/// <summary>
		/// Gets or sets the list font's style.
		/// </summary>
		[ XmlElement( "listFontStyle" ) ]
		public FontStyle ListFontStyle
		{
			get
			{
				return m_ListFontStyle;
			}
			
			set
			{
				m_ListFontStyle = value;
			}
		}
		
		/// <summary>
		/// Gets or sets the view http headers setting.
		/// </summary>
		[ XmlElement( "viewHttpHeaders" ) ]
		public bool ViewHttpHeaders
		{
			get
			{
				return m_ViewHttpHeaders;
			}
			
			set
			{
				m_ViewHttpHeaders = value;
			}
		}
		
		/// <summary>
		/// Gets or sets the view raw soap message setting.
		/// </summary>
		[ XmlElement( "viewRawSoapMessage" ) ]
		public bool ViewRawSoapMessage
		{
			get
			{
				return m_ViewRawSoapMessage;
			}
			
			set
			{
				m_ViewRawSoapMessage = value;
			}
		}		
		
		/// <summary>
		/// Gets or sets the view soap message parameters setting.
		/// </summary>
		[ XmlElement( "viewSoapMessageParameters" ) ]
		public bool ViewSoapMessageParameters
		{
			get
			{
				return m_ViewSoapMessageParameters;
			}
			
			set
			{
				m_ViewSoapMessageParameters = value;
			}
		}		
		
		/// <summary>
		/// Gets or sets the view soap envelope setting.
		/// </summary>
		[ XmlElement( "viewSoapEnvelope" ) ]
		public bool ViewSoapEnvelope
		{
			get
			{
				return m_ViewSoapEnvelope;
			}
			
			set
			{
				m_ViewSoapEnvelope = value;
			}
		}		
		
		/// <summary>
		/// Gets or sets the listview's width.
		/// </summary>
		[ XmlElement( "soapMessagesPanelWidth" ) ]
		public int SoapMessagesPanelWidth
		{
			get
			{
				return m_SoapMessagesPanelWidth;
			}
			
			set
			{
				m_SoapMessagesPanelWidth = value;
			}
		}
		
		/// <summary>
		/// Gets or sets the message request panel's height.
		/// </summary>
		[ XmlElement( "messageRequestPanelHeight" ) ]
		public int MessageRequestPanelHeight
		{
			get
			{
				return m_MessageRequestPanelHeight;
			}
			
			set
			{
				m_MessageRequestPanelHeight = value;
			}
		}
		
		/// <summary>
		/// Gets or sets the time's column width.
		/// </summary>
		[ XmlElement( "timeColumnHeaderWidth" ) ]
		public int TimeColumnHeaderWidth
		{
			get
			{
				return m_TimeColumnHeaderWidth;
			}
			
			set
			{
				m_TimeColumnHeaderWidth = value;
			}
		}
		
		/// <summary>
		/// Gets or sets the web service operation's column width.
		/// </summary>
		[ XmlElement( "webServiceOperationColumnHeaderWidth" ) ]
		public int WebServiceOperationColumnHeaderWidth
		{
			get
			{
				return m_WebServiceOperationColumnHeaderWidth;
			}
			
			set
			{
				m_WebServiceOperationColumnHeaderWidth = value;
			}
		}
		
		/// <summary>
		/// Gets or sets the web service name's column width.
		/// </summary>
		[ XmlElement( "webServiceColumnHeaderWidth" ) ]
		public int WebServiceColumnHeaderWidth
		{
			get
			{
				return m_WebServiceColumnHeaderWidth;
			}
			
			set
			{
				m_WebServiceColumnHeaderWidth = value;
			}
		}	
		
		/// <summary>
		/// Gets or sets the source's column width.
		/// </summary>
		[ XmlElement( "sourceColumnHeaderWidth" ) ]
		public int SourceColumnHeaderWidth
		{
			get
			{
				return m_SourceColumnHeaderWidth;
			}
			
			set
			{
				m_SourceColumnHeaderWidth = value;
			}
		}		
	}
}
